/**
 * Copyright (C) 2013-2014 the original author or authors.
 */
package com.foreveross.bsl.system.application;

import java.util.List;

import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.foreveross.bsl.system.application.vo.AccountVO;


/**
 * @description
 *
 * @author rening
 * @version v1.0
 *
 * @2013-6-7
 *
 */
@Path(value = "/accounts")
public interface AccountApplication {

	@POST
	@Path("/")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public AccountVO saveEntity(AccountVO entity);

	@PUT
	@Path("/{id}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public AccountVO updateEntity(@PathParam("id") String id, AccountVO entity);

	@DELETE
	@Path("/{id}")
	public void deleteEntity(@PathParam("id") String id);
	
	@GET
	@Path("/{id}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public AccountVO getEntity(@PathParam("id") String id);
	
	@GET
	@Path("/field/{username}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public List<AccountVO> getEntityByUserName(@PathParam("username") String username);
	
	@GET
	@Path("/{username}/{password}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public AccountVO getEntityByUserNameAndPassword(@PathParam("username") String username,@PathParam("password") String password);

	@GET
	@Path("/list/{status}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public List<AccountVO> findAllByStatus(@PathParam("status") String status);

	@GET
	@Path("/")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public List<AccountVO> findAll();

	@POST
	@Path("/pages")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public Page<AccountVO> findByPageable(Pageable pageable);
	
	@POST
	@Path("/parampages")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public Page<AccountVO> findByPageable(Pageable pageable, AccountVO account);
	
	@POST
	@Path("/login")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public String login(@FormParam("username") String username, @FormParam("password") String password);
	
	@POST
	@Path("/login-admin")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public String login(@FormParam("accUsername") String accUsername, @FormParam("username") String username, @FormParam("password") String password);
	
	@POST
	@Path("/mobile/login")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public String mobileLogin(@FormParam("appKey") String appKey, @FormParam("username") String username, @FormParam("password") String password);
	
	@POST
	@Path("/logout/{sessionKey}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public void logout(@PathParam("sessionKey") String sessionKey);
	
	@POST
	@Path("/updateMultiStatusByIds")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public int updateMultiStatusByIds(@FormParam("ids") String[] ids,@FormParam("status") String status);
	
}
